#include "AT24C02.h"
#include "stdio.h"
#include "mf_i2c.h"
#include "log.h"

const static char *TAG = "at24c02.c";

void at24_demo(void)
{
    bool ret = FL_PASS;
    uint16_t addr = 0x0002;
    uint8_t rd_buff;

    ret |= mf_i2c_master_read_from_device(0x50, addr, I2C_REG_OVER_ADDR, &rd_buff, 1); // 读EE测试
    MY_LOGI(TAG, "addr[0x%X]->0x%X [%d]\r\n", addr, rd_buff, ret);

    rd_buff += 1;
    ret |= mf_i2c_master_write_to_device(0x50, addr, I2C_REG_OVER_ADDR, &rd_buff, 1); // 写EE测试

    ret |= mf_i2c_master_read_from_device(0x50, addr, I2C_REG_OVER_ADDR, &rd_buff, 1); // 读EE测试
    MY_LOGI(TAG, "set[0x%X]->0x%X [%d]\r\n", addr, rd_buff, ret);
}
